package cn.java.basic;

class JTeacher extends JPerson
{
    public void work()
    {
        System.out.println("我的工作是教书");
    }
}

class JFarmer extends JPerson
{
    public void work()
    {
        System.out.println("我的工作是种田");
    }
}

class JWorker extends JPerson
{
    public void work()
    {
        System.out.println("我的工作是生产");
    }
}

class JBussinessman extends JPerson
{
    public void work()
    {
        System.out.println("我的工作是经商");
    }
}

public class JPolymorphism
{
    public static void main(String[] args)
    {
        JPerson person=new JStudent();
        person.work();
        person=new JFarmer();
        person.work();
        person=new JWorker();
        person.work();
        person=new JBussinessman();
        person.work();
    }
}
